package com.hibase.core.rule.web.rulemenu;


import com.hibase.common.entity.ResponseModel;
import com.hibase.core.rule.entity.ruledebug.RuleCallParamVO;
import com.hibase.core.rule.service.ruleexecute.RuleExecuteService;
import com.hibase.core.web.annotation.HibasePostRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 描述:
 * 规则执行
 *
 * @author li-wei-hua
 * @date 2020-04-16 10:07
 */
@RestController
@RequestMapping("/rule-execute")
@Api(tags = "规则执行")
public class RuleExecuteController {

    @Autowired
    private RuleExecuteService ruleExecuteService;

    @ApiOperation(value = "执行",httpMethod = "POST")
    @HibasePostRequestMapping(value = "/callRule")
    public ResponseModel<String> callRule(@RequestBody RuleCallParamVO paramVO)  {
        try{
            return ResponseModel.successMsg(ruleExecuteService.callRule(paramVO));
        }catch (Exception ex ){
            ex.printStackTrace();
            return ResponseModel.failMsg(2, ex.getMessage());
        }
    }

}
